package com.qumitech.visualnovel.service.taskrecord.impl;

import com.qumitech.visualnovel.datasource.console.TaskRecordMapper;
import com.qumitech.visualnovel.model.dao.console.TaskRecord;

import com.qumitech.visualnovel.service.taskrecord.TaskRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class TaskRecordServiceImpl implements TaskRecordService {

    @Autowired
    TaskRecordMapper taskRecordMapper;

    @Override
    public List<TaskRecord> ListTask(String userName, String startTime, String endTime,int offset, int pageSize){
        return taskRecordMapper.ListTask(userName,startTime,endTime,offset,pageSize);
    }

    @Override
    public int CountTaskList(String userName, String startTime, String endTime,int offset, int pageSize){
        return taskRecordMapper.CountTaskList(userName,startTime,endTime,offset,pageSize);
    }

    @Override
    public TaskRecord insert(String modelName,String title, Byte status, String downloadUrl,String operatePerson, String extraParam) {
        TaskRecord record = new TaskRecord();
        record.setModelName(modelName);
        record.setTitle(title);
        record.setStatus(status);
        record.setDownloadUrl(downloadUrl);
        record.setOperatePerson(operatePerson);
        record.setExtraParam(extraParam);
        taskRecordMapper.insertSelective(record);
        return record;
    }
    @Override
    public int insert(TaskRecord record) {
        return taskRecordMapper.insertSelective(record);
    }

    @Override
    public int update(TaskRecord record) {
        return taskRecordMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public TaskRecord selectByPrimaryKey(Integer id) {
        return taskRecordMapper.selectByPrimaryKey(id);
    }


    @Override
    public  List<TaskRecord> getList(String modelName, Integer accountId, Integer status, String startTime, String endTime,
                             int offset, int pageSize, String orderBy, String orderType){
        return taskRecordMapper.getList(modelName, accountId, status,startTime, endTime, offset, pageSize, orderBy, orderType);

    }

    @Override
    public int getCount(String modelName, Integer accountId, Integer status, String startTime, String endTime){

        return taskRecordMapper.getCount(modelName, accountId, status,startTime, endTime);

    }
}
